Repository navigation
fix(fields): the lookup picker fits the room it is given, marks a cut row, and lets option previews wrap - #34381
Conversation
…p the preview The option list takes the room Radix reports on the side the popover opens to, fades the edge it continues past, and lets an option's preview wrap onto a second row so two text columns are not both cut to one row. Claude-Session: https://claude.ai/code/session_01ADHkmSg4bMFcuXXpNikRnL Co-authored-by: Claude <noreply@anthropic.com>
|
domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi 维护者速读
席位意见先测出真正的原因(固定高度,而不是没有翻转),再在查找控件里按可用空间约束,没有改共享的 popover。边缘渐隐让被切掉的行读作「还能滚动」。副标题仍守 #13123 的规则:徽标不收缩,值截断但不短于标签。同意落地。 席位核对 — ACCEPT · domain:ui#2 · head 3e202af · 2026-11-16T21:57Z |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43965649708 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi Merge-queue triage: re-queue once · head 3e202af · 2026-11-16T22:30Z The queue build 43965649708 failed in one job,
Re-queued once on the same head. If it fails again on a test, the seat triages it as this PR's. |
Requested by Steve · project thread
Fixes #34362
Clause-②: no
Metadata-protocol: none
维护者速读
@object-ui/fields的 LookupField 弹层/列表/选项行,无契约与服务端改动;未改共享popover.tsx。副标题由单行变为最多两行,选项行可能变高,16rem 内可见行数会减少(两行副标题时约 3½ 行)。回滚即 revert 本 PR。ui/packages/fields/src/widgets/LookupField.tsx的fitPreviewLine(换行、行数上限、换行列去掉分隔点、截断值写 title);② 同文件PopoverContent与 listbox 的类名及listMore渐隐;③ 测试文件LookupField.previewBadges-13123.test.tsx改写的布局模型。pnpm --dir ui exec vitest run packages/fields/src/widgets/LookupField.previewBadges-13123.test.tsx,预期 17 个测试全过。Root cause (measured)
Measured in Chromium with the real
LookupFieldand the realDialog, bundled from source (the bundling ofe2e/permission-field-panel-scroll.spec.ts, real Tailwind theme), inside a dialog with the action dialog's classes (flex max-h-[90vh] flex-col), at 1280×800, with ten contacts previewing Email and Account like the card's picker. The probe was a one-off and is not committed.PopoverContentalready renders through a Radix portal intobody, so no dialog body clips it, and Radix's defaultflipmeasures against the viewport. With the field near the dialog's bottom (space below 259 / 179 / 121 px, above 501 / 581 / 639 px) the popover opened on top every time (data-side="top"), fully inside the viewport. No collision boundary and no portal problem.max-h-64. The list was 256 px whatever the room. An option with a one-line preview is 56 px tall, so the fifth row always showed 32 of its 56 px: its name, not its preview, exactly as the card describes, below or above the field alike, with nothing saying the list scrolls.--radix-popover-content-available-heightread 257 px; the list ignored it).Email: emily.davis@starkmed.e…andAccount: Stark Medic…were both cut, and the account name that tells same-named contacts apart was lost.After the fix, same probe: the popover still opens on top at 259 / 179 / 121 px below; at 1280×480 it is 257 px tall at
top: 0(inside the viewport) with the list at 207 px; every preview shows the full email on its first row and the full account on its second; the cut row at the list's bottom sits under a fade.What changes
PopoverContent(inLookupField, not the sharedpopover.tsx):flex flex-col max-h-(--radix-popover-content-available-height). The search row, the error state and the loading state areshrink-0; the list (in arelative flex min-h-0 flex-colwrapper) ismax-h-64 min-h-0, so it takes what the search row leaves, up to the same 16rem. Radix's default flip is kept: it still moves the popover to the side with more room whenever the whole popover does not fit below.listMoretracks whether options continue above or below the list's visible box (read after every commit, on scroll, and from aResizeObserveron the list, attached by a callback ref); each edge with more past it draws anaria-hiddengradient (lookup-list-more-above/lookup-list-more-below). The list carriesscroll-py-6, so the arrow keys'scrollIntoView({ block: 'nearest' })stops an option clear of the fade.flex-wrap(gap-x-1 gap-y-0.5).fitPreviewLinenow hides trailing segments while the line overflows its width OR its shown segments span more thanLOOKUP_PREVIEW_MAX_ROWS(2) rows, read off the segments'offsetTop. So a column that does not fit beside the one before it moves whole to the second row, and a column that does not fit in two rows leaves whole, with every column after it. A shown segment that opens a row hides its leading·. A text value (data-lookup-preview-text) whose box is narrower than its content gets its full text astitle; one that fits has none. The objectui#13123 rules stand: a badge column never shrinks, a text value never shrinks below its label..changeset/34362-lookup-picker-room.md(@object-ui/fields: patch).Tests
All in the existing shared harness file
LookupField.previewBadges-13123.test.tsx(jsdom has no layout, so the pins read classes, attributes and stubbed boxes, not pixels):describe('LookupField picker popover: bound to the room it is given (objectstack#34362)'): the popover is portaled out of the field into Radix's popper wrapper; it carriesflex,flex-colandmax-h-(--radix-popover-content-available-height); the search row isshrink-0; the list ismin-h-0 max-h-64 overflow-y-autoin amin-h-0wrapper; the below / above fades follow a stubbed scroll box through scroll to the end and back; no fade when every option fits; the list carriesscroll-py-6.describe('LookupField option preview: secondary columns stay told apart (objectstack#34362)'): the line isflex-wrap; a column that opens the second row drops its separator, one beside its predecessor keeps it, and every separator stays on one row; a cut text value gets its full text astitle, a whole one and a badge get none.describe('LookupField option preview: a column the line cannot hold leaves whole (objectui#13123)')(renamed "…the rows cannot hold…") now wraps segments onto rows (offsetTopstubbed) instead of modelling one row, because the line now wraps. Its cases moved with the model: at 280 px all three columns show (revenue wraps to row two, was dropped); at 180 px status and industry show (one column a row, the third row is one too many; was status only); 600 px and 100 px are unchanged. The resize case now goes 180 → 600 → 100 px ([status, industry]→ all → none). Every assertion of the three "badge never cut / text still truncates / segment whole" tests above it is unchanged.Acceptance notes
content/docs/data-modeling/field-types.mdxdescribes the picker's features only), so no docs change is owed.popover.tsx(shared by every popover) is not touched: the cause was in the lookup's own list, not in the primitive.Verification
Tests
pnpm --dir ui exec vitest run packages/fields/src/widgets/LookupField.previewBadges-13123.test.tsx→ Tests 17 passed.pnpm --dir ui exec vitest run packages/fields/ --maxWorkers=2→ Test Files 306 passed, 1 skipped; Tests 4633 passed, 7 skipped.pnpm --filter @object-ui/fields run type-check(tsc --noEmit && tsc -p tsconfig.test.json) → exit 0.pnpm --dir ui exec eslinton the two changed files → exit 0 (0 errors; the warnings are pre-existing lines).pnpm --dir ui run check:new-line-citations→ 0 new citations.Ablations (scripts/ablation-replace.mjs, mutation proven on disk, each restored to HEAD blob 010d418f431b)
max-h-(--radix-popover-content-available-height)from the popover → "caps the popover…" red (1 failed / 16 passed).min-h-0from the list → "caps the popover…" red (1 / 16).below:always false → "marks the list edge…" red (1 / 16).|| previewRowsOf(segments) > LOOKUP_PREVIEW_MAX_ROWS) → the 180 px case and the resize case red (2 / 15).if (separator && opensRow) separator.hidden = true;→ "drops the separator…" red (1 / 16).titleon a cut value → "gives a text value cut short…" red (1 / 16).flex-wrap→ "lets the preview wrap…" red (1 / 16).Derived gate families
Head
c3c5b8cc,node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 38 commands, all exit 0.--ranreconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.Every family CI runs is read from this PR's check-runs, not re-run here.
Generated by Claude Code